function resetRBlood()
{
	exec("./server.cs");
}

exec("./emitters.cs");
exec("./explosions.cs");


function checkPref(%pref)
{
	if(%pref $= "")
		return true;
	else
		return false;
}

																											// -- General Blood -----
if(checkPref($Pref::RBloodMod::MinimumBloodThreshold)) 	$Pref::RBloodMod::MinimumBloodThreshold = 1;		// Minimum amount of damage required for blood to appear
if(checkPref($Pref::RBloodMod::BloodFadeTime)) 			$Pref::RBloodMod::BloodFadeTime = 15000;			// Time blood static shapes will stick around before disappearing
if(checkPref($Pref::RBloodMod::DisableStatic))			$Pref::RBloodMod::DisableStatic = false;			// Disable/Enable static shape blood
if(checkPref($Pref::RBloodMod::DisablePuddleTrigger))	$Pref::RBloodMod::DisablePuddleTrigger = false;		// Disable/Enable spawning of triggers that add blood to player's feet when walking over blood puddles
if(checkPref($Pref::RBloodMod::UseCubeGore)) 			$Pref::RBloodMod::UseCubeGore = true;				// Disable/Enable cube debris based gore
if(checkPref($Pref::RBloodMod::LimbReddening))			$Pref::RBloodMod::LimbReddening = true;				// Disable/Enable player limb node reddening when exposed to blood
if(checkPref($Pref::RBloodMod::LimbReddeningFactor))	$Pref::RBloodMod::LimbReddeningFactor = 0;			// Raise this to lower the amount of reddening that occurs
if(checkPref($Pref::RBloodMod::LimbReddeningSplash))	$Pref::RBloodMod::LimbReddeningSplash = 1;			// Scale amount of limb reddening splash that occurs when someone is shot
if(checkPref($Pref::RBloodMod::BloodColor))				$Pref::RBloodMod::BloodColor = "1 0 0 1";			// Color of blood

																											// -- Dismemberment -----
if(checkPref($Pref::RBloodMod::UseLimbStubs))			$Pref::RBloodMod::UseLimbStubs = true;				// Disable/Enable limb dismemberment stubs
if(checkPref($Pref::RBloodMod::DismemberDamage))		$Pref::RBloodMod::DismemberDamage = 90; 			// Damage required to shoot off a limb
if(checkPref($Pref::RBloodMod::DismemberTime)) 			$Pref::RBloodMod::DismemberTime = 5;				// Minimum time in ms between a limb being damaged and player's death for it to be dismembered

																											// -- Explosions --------
if(checkPref($Pref::RBloodMod::DistanceToGib))			$Pref::RBloodMod::DistanceToGib = 6;				// Distance from epicenter of explosion required to gib players killed in explosions
if(checkPref($Pref::RBloodMod::MinimumGibDamage))		$Pref::RBloodMod::MinimumGibDamage = 70;			// Minimum radius damage required to gib somebody
if(checkPref($Pref::RBloodMod::StaticBloodAmt))			$Pref::RBloodMod::StaticBloodAmt = 1;				// Scale amount of static blood that occurs when someone is gibbed

																											// -- Bleeding -----------
if(checkPref($Pref::RBloodMod::DisableBleed))			$Pref::RBloodMod::DisableBleed = false;				// Disable/Enable bleeding after damage
if(checkPref($Pref::RBloodMod::BloodTimeScale)) 		$Pref::RBloodMod::BloodTimeScale = 1; 				// Scale length of bleeding effect
if(checkPref($Pref::RBloodMod::BloodAmountScale)) 		$Pref::RBloodMod::BloodAmountScale = 1; 			// Scale amount of blood that occurs during blood effect


$Pref::RBloodMod::PlayerBaseShape = "base/data/shapes/player/m.dts";
$Pref::RBloodMod::PlayerBaseShape0 = "base/data/shapes/player/mmelee.dts";

function rBloodPlayerShapeAllowed(%shape)
{
	if(%shape $= $Pref::RBloodMod::PlayerBaseShape || %shape $= $Pref::RBloodMod::PlayerBaseShape0)
		return true;
	return false;
}


$RBloodLimbString0 = "headskin helmet pointyHelmet flareHelmet scoutHat bicorn copHat knitHat plume triPlume septPlume visor";
$RBloodLimbString1 = "";
$RBloodLimbString2 = "rhand rhook rarm rarmslim";
$RBloodLimbString3 = "lhand lhook larm larmslim";
$RBloodLimbString4 = "rshoe rpeg";
$RBloodLimbString5 = "lshoe lpeg";
$RBloodLimbString6 = "chest pants femchest skirtHip armor bucket cape pack quiver tank"; // For reddening


datablock TriggerData(rbloodPuddleTriggerData)
{
	tickPeriodMS = 15000; // Used with ::onTickTrigger.
};

// Easier than trying to rotate blood shapes on their axis
datablock StaticShapeData(bloodPuddleStaticShape)
{
	shapeFile = "./puddle.dts";
};
datablock StaticShapeData(bloodPuddleStaticShape2)
{
	shapeFile = "./puddle45.dts";
};
$RBloodPuddleStatic0 = bloodPuddleStaticShape;
$RBloodPuddleStatic1 = bloodPuddleStaticShape2;

exec("./damloc.cs");
exec("./math.cs");
exec("./rblood.cs");

if(!$Pref::RBloodMod::UseCubeGore)
{
	bloodBurstFinalExplosion.debris = "";
}